package com.yeyaomai.dksns.flowis.service.impl;

import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yeyaomai.dksns.flowis.dao.EngineDao;
import com.yeyaomai.dksns.flowis.dao.EngineKeywordDao;
import com.yeyaomai.dksns.flowis.domain.Engine;
import com.yeyaomai.dksns.flowis.domain.EngineKeyword;
import com.yeyaomai.dksns.flowis.service.EngineService;

/**
 * 搜索引擎Service层实现
 * @author sun_shan
 * 
 */
@Service
public class EngineServiceImpl implements EngineService {

	@Resource
	private EngineDao engineDao;
	
	@Resource
	private EngineKeywordDao engineKeywordDao;


	@Override
	public void addEngine(Engine engine) {
		
		engineDao.addEngine(engine);
	}
	
	@Override
	public List<Engine> getEngineByDate(String st ,String et) {
		
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("st", st);
		map.put("et", et);
		return engineDao.getEngineByDate(map);
	}
	
	@Override
	public List<Engine> getEngineByEngineDate(String engineName, String st,String et) {
		
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("engineName", engineName);
		map.put("st", st);
		map.put("et", et);
		return engineDao.getEngineByEngineDate(map);
	}
	
	@Override
	public List<Engine> getSearchCountByDate(String st, String et) {
		
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("st", st);
		map.put("et", et);
		return engineDao.getSearchCountByDate(map);
	}
	
	@Override
	public List<EngineKeyword> getEngineKeywordByEngineDate(String engineName,String st, String et) {
		
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("engineName", engineName);
		map.put("st", st);
		map.put("et", et);
		return engineKeywordDao.getEngineKeywordByEngineDate(map);
	}
	
	@Override
	public int getEngineKeywordByEngineDateCount(String engineName, String st,String et) {
		
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("engineName", engineName);
		map.put("st", st);
		map.put("et", et);
		return engineKeywordDao.getEngineKeywordByEngineDateCount(map);
	}
}
